<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!-- onclick 事件会在元素被点击时发生。 -->
<button onclick="sendGet()">发送GET请求</button>
<button onclick="sendPost()">发送POST请求</button>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
    function sendGet(){
        $.ajax({
            type:"get",
            url:"method",
            success:function(data,status){
                console.log(data);
            }
        });
    }
    function sendPost(){
        $.ajax({
            type:"post",
            url:"method",
            data:"request body",
            success:function(data,status){
                console.log(data);
                console.log(status);
            }
        });
    }
</script>
</body>
</html>